<?php
@session_start();
include "../../../jerimum/classes/bd.php";
include "../../../jerimum/classes/anuncios.php";

$_anu	= new anuncios(); #CLASSES

#SETA CLIENTE
$_anu->cliente	= $_SESSION['idcliente'];

#LISTA TODOS OS ANUNCIOS ATIVOS
$_anu->ativo	= 1;
$totalanuncios	= $_anu->numeroanuncio();

###############################################
#LISTA TODOS OS ANUNCIOS ATIVOS################
$where			= "WHERE cliente = '".$_SESSION['idcliente']."' and ativo ='1' ";
$order			= " ORDER BY id ";
$limit			= "";
$dadostotal	= $_anu->lista($where,$order,$limit);
###############################################
###############################################

//print_r($_SESSION);

?>
<style type="text/css">
#TableDestalhes{ border:solid 1px #CCCCCC; border-collapse:collapse}
#TableDestalhes tr td {border:1px solid #CCCCCC; padding:4px}
</style>
<style type="text/css">
<!--
.span-verde {color:#0C0
}
-->
</style>





<table width="528" id="TableDestalhes">

  <tr>
    <td colspan="3" align="left" valign="top" bgcolor="#f9f9f9"><div style="font-size:16px">
Visualizando <span class="span-vermelho">> Anúncios online</span> (<?=$totalanuncios?>)</div></td>
   
  </tr>
	
    
  <tr>
    <td width="46" align="left" valign="top"><h3 style="font-weight:normal; margin:0px">COD</h3></td>
    <td width="265" align="left" valign="top"><h3 style="font-weight:normal; margin:0px">NOME DO ANÚNCIO</h3></td>
    <td width="201" valign="top"><h3 style="font-weight:normal; margin:0px">OP&Ccedil;&Otilde;ES</h3></td>
  </tr>
  
  <?php if(count($dadostotal)==0){	?>
  
  <tr>
    <td colspan="3" align="left" valign="top" class="span-vermelho">Não existem anúncios ativo.</td>
  </tr>
  
  <? }else{
	
	foreach($dadostotal as $dados){ 
	$x%2 == 0?$corfundo = "#FFFFFF":$corfundo = "#F9F9F9";
	
	?>
  
  <tr bgcolor="<?=$corfundo?>">
   <td class="span-azul"><?=$dados['id']?></td>
    
    <td align="left" valign="top" class="span-azul"><?=htmlentities($dados['titulo'])?></td>
    
    <td valign="top"> <a href="painel.php?acao=edita-anuncio&anuncio=<?=$dados['id']?>">editar</a> | <a href="javascript:void(0);" onClick="javascript: if(confirm('Deseja realmente finalizar este anúncio?')){ acaopainel('modulos/painel/anuncios/acao.php','finalizar',<?=$dados['id']?>,'modulos/painel/anuncios/anuncio-online.php'); }else{return false; }">finalizar</a> | <a href="javascript:void(0);" onClick="javascript: if(confirm('Seu anúncio é ótimo! Deseja realmente desativá-lo?')){ acaopainel('modulos/painel/anuncios/acao.php','desativar',<?=$dados['id']?>,'modulos/painel/anuncios/anuncio-online.php');}else{return false; }" title="">desativar</a></td>
  </tr>
  
  <? $x++; } } ?>
  
  
</table>